<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:include href="core\form.xsl"/>
<xsl:include href="core\layout_empty.xsl"/>

<xsl:template name="page_content">
	<xsl:call-template name="title_page">
		<xsl:with-param name="titleText">Virtual Tours</xsl:with-param>
	</xsl:call-template>
	<table cellspacing="1" cellpadding="5" width="100%">
		<xsl:if test="warning!=0"><tr><td><xsl:value-of select="warning"/></td></tr></xsl:if>
		<tr>
			<td valign="top" width="20%"><xsl:apply-templates select="rowset[@id='vr']"/></td>
			<td valign="top">
				<xsl:if test="rowset[@id='vr'] and not(rowset[@id='vrplaying'])">
					<xsl:call-template name="default_vr">
						<xsl:with-param name="filename">
							<xsl:value-of select="rowset[@id='vr']/data/row/col[@name='image_file']"/>
						</xsl:with-param>
					</xsl:call-template>
				</xsl:if>
				<xsl:if test="rowset[@id='vrplaying']">
					<xsl:call-template name="default_vr">
						<xsl:with-param name="filename">
							<xsl:value-of select="rowset[@id='vrplaying']/data/row/col[@name='image_file']"/>
						</xsl:with-param>
					</xsl:call-template>
				</xsl:if>
			</td>
			<td valign="top" align="left" width="80%">
				<xsl:if test="rowset[@id='vr'] and not(rowset[@id='vrplaying'])">
					<xsl:call-template name="comment">
						<xsl:with-param name="comment">
							<xsl:value-of select="rowset[@id='vr']/data/row/col[@name='comment']"/>
						</xsl:with-param>
					</xsl:call-template>
				</xsl:if>
				<xsl:if test="rowset[@id='vrplaying']">
					<xsl:call-template name="comment">
						<xsl:with-param name="comment">
							<xsl:value-of select="rowset[@id='vrplaying']/data/row/col[@name='comment']"/>
						</xsl:with-param>
					</xsl:call-template>
				</xsl:if>
			</td>
		</tr>
	</table>
	<hr width="80%" size="1" noshade="true" color="#CCCCCC"/>
	<table cellpadding="2" cellspacing="2" align="center">
		<tr>
			<td align="center"><a href="#" onClick="window.close();"><img src="{$img_path_templates}/{$header_bg_color}/buttons/btn_close.gif" border="0"/></a></td>
		</tr>
	</table>
<xsl:choose>
<xsl:when test="/page/rowset[@id='vr'] and not(/page/rowset[@id='vrplaying'])">
	<script>
		vid = "<xsl:value-of select="/page/rowset[@id='vr']/data/row/col[@name='vessels_images_id']"/>";
	</script>
</xsl:when>
<xsl:otherwise>
	<script>
		vid = "<xsl:value-of select="/page/rowset[@id='vrplaying']/data/row/col[@name='vessels_images_id']"/>";
	</script>
</xsl:otherwise>
</xsl:choose>
	<script>
	  	  	window.document.onload = VRTourSet(vid);
			function VRTourSet(vid){
//			alert(document.all('link'+vid).style);
			    document.all('link'+vid).style.font = 'italic bold 9pt arial';
//			alert(document.all('link'+vid).style.font);
		  	}
	</script>	
</xsl:template>

<xsl:template match="rowset[@id='vr']">
	<xsl:variable name="vessels_id"><xsl:value-of select="/page/vessel_id"/></xsl:variable>

	<table cellspacing="1" cellpadding="5" width="100%">
		<tr>
			<td align="left" valign="top" bgcolor="{$header_bg_color}">
				<font color="{$color_title}">Section Name</font>
			</td>
		</tr>
		<xsl:for-each select="data/row">
			<xsl:variable name="vid"><xsl:value-of select="col[@name='vessels_images_id']"/></xsl:variable>
			<xsl:variable name="image_f"><xsl:value-of select="col[@name='image_file']"/></xsl:variable>
			<xsl:variable name="description"><xsl:value-of select="col[@name='description']"/></xsl:variable>
			<tr>
				<td>
					<nobr>&#160;&#160;<a href="main.asp?-preview_ivr.asp-fvessel_id={$vessels_id}&amp;ivrid={$vid}&amp;action=next" title="{$description}" name="link{col[@name='vessels_images_id']}"><font color="{$color_main_first1}"><xsl:value-of select="col[@name='name']"/></font></a></nobr>
				</td>
			</tr>
		</xsl:for-each>
	</table>
</xsl:template>

<xsl:template name="default_vr">
	<xsl:param name="filename"/>
	<xsl:variable name="dd" select="'http://75.77.170.130/include/ivrzips/aftdeck_mj.ivr'"/>
	<xsl:choose>
		<xsl:when test="contains($filename, '.ipx') or contains($filename, '.IPX')">
			<applet code="IpixViewer.class"	archive="IpixViewer.jar" codebase="{$http_base}/applets/ipx_applet/files/" align="baseline" width="320" height="240" name="IpixViewer">
	 			<param name="URL"><xsl:attribute name="value"><xsl:value-of select="concat($http_base,'/applets/ipx_applet/files/',$filename)"/></xsl:attribute></param>
			 	<param name="Warp" value="1"/>
			 	<param name="Toolbar" value="large"/>
				<param name="BackgroundColor" value="#ffffff"/>
			 	<param name="HelpURL" value="help/java3_2"/>
			 	<param name="SpinSpeed" value="-5"/>
			 	<param name="SpinStyle" value="flat"/>
			</applet>
		</xsl:when>
		<xsl:when test="contains($filename, '.IVR') or contains($filename, '.ivr')">
			<applet archive="/include/ivrzips/lpjpano.zip" code="LPPano.class" width="358" height="240">
				<param name="cabbase" value="/include/ivrzips/lpjpano.cab"/>
				<param name="file"><xsl:attribute name="value"><xsl:value-of select="concat(/page/http_base,'/yacht_images/ivr_',vessels_id,'/',$filename)"/></xsl:attribute></param>
			</applet>
		</xsl:when>					
		<xsl:when test="contains($filename, '.ips') or contains($filename, '.IPS')">
			<object ID="IpixX1" WIDTH="525" HEIGHT="320" CLASSID="CLSID:11260943-421B-11D0-8EAC-0000C07D88CF" CODEBASE="http://www.ipix.com/viewers/ipixx.cab#version=6,0,0,2">
				<param name="IPXFILENAME"><xsl:attribute name="value"><xsl:value-of select="concat(/page/http_base,'/applets/ipx_applet/files/',$filename)"/></xsl:attribute></param>
				<xsl:if test="not(//browser_info/name='IE')">
  					<embed src="/ipix/file40sr98.ips" border="0" width="525" height="320" palette="FOREGROUND" type="application/x-ipix" pluginsPage="http://www.ipix.com/cgi-bin/download.cgi"/>
				</xsl:if>
			</object>
		</xsl:when>
		<xsl:when test="contains($filename, '.mov') or contains($filename, '.mov')">
			<EMBED SRC="{$http_base}/applets/ipx_applet/files/{$filename}" WIDTH="300" HEIGHT="250" AUTOPLAY="TRUE" LOOP="True" CONTROLLER="False" PLAYEVERYFRAME="False" cache="true" pluginspage="http://www.apple.com/quicktime/download" BGCOLOR="#000000"/>
		</xsl:when>	
	</xsl:choose>
</xsl:template>

<xsl:template name="comment">
	<xsl:param name="comment"></xsl:param>
	<xsl:if test="string-length($comment)>0">
	<table cellspacing="1" cellpadding="5" width="100%">
	<tr bgcolor="{$header_bg_color}"><td width="90%"><font color="{$color_title}">Comment</font></td></tr>
	<tr>
		<td>
			<xsl:value-of select="$comment" disable-output-escaping="yes"/>
		</td>
	</tr>
	</table>
	</xsl:if>
</xsl:template>

</xsl:stylesheet>
